  import store from '@/store.js'
  console.log(store)
  export default {
  	store,
  	computed:{
      openid(){
        return store.state.index.openid
      },
      token(){
       return store.state.index.token
     },
     userInfo(){
      return store.state.index.userInfo

    }
  },
  methods:{
    getUser(){
      this.$http.post('api/Appwallet/getUser',{},res=>{
        if (res.code == 1) {
          this.$store.dispatch('setUser', {userInfo: res.data})
        }
      })
    },
    getLocation(){
     wx.getLocation({
      success:(res)=>{
       this.$store.dispatch('setMyLocation',{location:{latitude: res.latitude, longitude:res.longitude}})
     }
   })
   },
   makePhoneCall(phoneNumber){
     wx.makePhoneCall({
      phoneNumber: phoneNumber 
    })
   },
   previewView(item){
     if (item.type != 'mp4') {
      this.previewImage(item.pic)
    }else{
      this.previewVideo(item.video)
      console.log(item)
    }
  },

  previewImage(img, arr){
   let array = arr || [img]
   wx.previewImage({
    current: img,
    urls: array
  })
 },
 previewVideo(video){
   this.$router('navigateTo', 'previewVideo',{video:video})
 }


},
created(){
}
}
